Image data transmission method and system and medium

By constructing the secondary data identification queue and the FIFO alternating storage method on the computer side, the problem of high CPU occupancy in the memory transmission of the acquisition card and the computer is solved, and efficient image data transmission and storage space optimization are achieved.

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

Patent Information

Application Number
CN202510263542.6
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, data transmission between the acquisition card and computer memory requires frequent CPU participation, resulting in high CPU usage and reduced bandwidth, especially when image data transmission is large, which cannot effectively reduce CPU usage.

Method used

Using a combination of first-level data identification and second-level data identification, a secondary data identification queue is constructed on the computer side, the storage addresses and number of several first-level data identifications are characterized, and the memory transmission is performed on the acquisition card side, and the secondary data identification queue and FIFO are used to alternately store and read first-level data identification to reduce CPU participation.

Benefits of technology

It effectively reduces CPU usage, improves data transmission bandwidth, avoids bandwidth reduction caused by unwritten first-level data identification, reduces storage space requirements, and realizes efficient image data transmission.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120295757A_ABST
    Figure CN120295757A_ABST
Patent Text Reader

Abstract

The invention discloses an image data transmission method and system 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 alternately completing the reading of the corresponding first-level data identifiers in the two first-level data identifier FIFOs. According to the method, the CPU only needs to be informed to participate when all image data corresponding to the second-level data identification is transmitted every time, the CPU occupancy rate can be effectively reduced, meanwhile, due to the fact that reading of all the second-level data identifications and reading of the corresponding first-level data identifications in the two first-level data identification FIFOs are completed alternately are conducted in parallel in the aspect of time, the CPU occupancy rate can be effectively reduced, and the processing efficiency is improved. Reading back of the first-level data identification and corresponding image data transmission can be continuously carried out, and the risk that the first-level data identification is empty and still not written in, so that the bandwidth is reduced is effectively avoided.
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, system and medium. Background Art

[0002] At present, 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 generally rounded up to 4 B 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 applied for. Therefore, for the transmission of a 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 12 MB image, if the average data amount corresponding to a single data identifier is 4 KB, then a frame of image requires 3072 data identifiers and 3072 independent transmissions. Calculated by 16 B for a single data identifier, the transmission of a frame of image requires 48 KB of data identifier storage space. If 100 image buffers are opened, about 4.8 MB 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 several times. 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 identifier cache space is opened in the FPGA at the acquisition card end. After the computer determines the data identifier, it writes to the acquisition card through the PCIe bus. The acquisition card end only stores a small amount of data identifiers required for the next transmission. When the cache space is full, the writing stops. During the transmission process, after all or part of the transmission data represented by this part of the data identifiers is completed, the CPU at the computer end monitors the remaining capacity of the data identifier cache space at the acquisition card end and writes the next data identifier 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 to the buffer, it becomes non-writable. 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 identifiers of the buffer that allows writing to the acquisition card, thus avoiding the acquisition card writing data to the buffer that does not allow writing in this way. This solution requires the CPU to participate intensively, has a high occupancy rate, and there is a risk of bandwidth reduction due to the data identifiers being used up and not being written.

[0005] Therefore, in order to reduce the CPU occupancy rate and increase the bandwidth, the present invention provides an image data transmission method, system 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, system and medium. Aiming at the problems of large storage space for primary data identifiers and high CPU occupancy rate, by setting primary data identifiers and secondary data identifiers at the computer end at the same time, the storage space requirements for primary data identifiers are met. The secondary data identifiers are used to describe the memory addresses and data volume information of the primary data identifiers, so as to reduce the CPU occupancy rate, and direct memory transfer is combined with the reading of the acquisition card.

[0007] To achieve the above technical objectives and achieve 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 identifiers corresponding to the image data, enabling the acquisition card end to directly access the image buffer at the computer end to transmit image data, wherein the primary data identifiers include the target storage address and the transmission data volume of the image data, and the transmission method includes: Construct a secondary data identifier queue at the computer end, so that any secondary data identifier corresponds to a number of consecutive primary data identifiers stored at the computer end, wherein 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 end in sequence, so that the acquisition card end sequentially reads the corresponding several primary data identifiers according to different secondary data identifiers; 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, and use two primary data identifier FIFOs to store alternately to complete the reading of all secondary data identifiers; Read all the primary data identifiers in the current primary data identifier FIFO in sequence until the cumulative number of times the acquisition card end writes the corresponding image data to the computer end reaches the storage quantity of the primary data identifiers represented by the corresponding secondary data identifier, so as to complete the transmission of the current frame of image data, and thus 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.

[0008] Further, whenever the transmission of the current frame of image data is completed, judge the quantity of secondary data identifiers allowed to be written at the acquisition card end, obtain the secondary data identifiers that do not exceed this quantity and are allowed to be written into the acquisition card end from the secondary data identifier queue, and 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 into the acquisition card end again.

[0009] Further, storing 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 includes: real-time monitoring of the quantity of primary data identifiers in the current primary data identifier FIFO: If the quantity is greater than the first threshold, stop writing the primary data identifiers; If the quantity is less than the second threshold, continue to write the primary data identifiers until the quantity is greater than the first threshold or all the primary data identifiers corresponding to the current secondary data identifier have been completely read.

[0010] Further, real-time control the writing state of the current primary data identifier FIFO: During the writing process, adjust it to the Busy state to limit the simultaneous writing of the primary data identifiers corresponding to different secondary data identifiers into the current primary data identifier FIFO; After the transmission of the current frame of image data is completed, adjust it to the non-Busy state to allow the primary data identifiers corresponding to the new secondary data identifier to be written into the current primary data identifier FIFO.

[0011] Further, several secondary data identifiers in the secondary data identifier queue correspond to one frame of image data.

[0012] Furthermore, each secondary data identifier in the secondary data identifier queue corresponds to several frames of image data.

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

[0014] Furthermore, the number of read primary data identifiers in the real-time monitored primary data identifier FIFO is monitored, and when this number reaches a preset value, it is fed back to the CPU to preprocess the data of the transmitted part of the current frame of image data.

[0015] The present invention also provides a data transmission system, including: A queue construction module, configured to construct a secondary data identifier queue on the computer side, so that any secondary data identifier corresponds to several consecutive primary data identifiers stored in the computer side, wherein the secondary data identifier is used to represent the start storage address and storage quantity of the corresponding several primary data identifiers; A queue acquisition module, configured to acquire 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 several primary data identifiers according to different secondary data identifiers; An identifier writing module, configured to sequentially store all the primary data identifiers corresponding to the current secondary data identifier into the same primary data identifier FIFO on the acquisition card side, and alternately store them using two primary data identifier FIFOs to complete the reading of all secondary data identifiers; An identifier reading module, configured to sequentially read all the primary data identifiers in the current primary data identifier FIFO until the cumulative number of times the acquisition card side writes the corresponding image data to the computer side reaches the storage quantity of the primary data identifiers represented by the corresponding secondary data identifier, so as to complete the transmission of the current frame of image data, and thus alternately complete the reading of the corresponding primary data identifiers in the two primary data identifier FIFOs.

[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 transmission method is implemented.

[0017] The beneficial effects of the present invention are: (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, since the reading of all secondary data identifiers and the alternate 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 still not being written.

[0018] (2) In the present invention, a secondary data identifier corresponds to a number of primary data identifiers continuously stored in the computer terminal. Only by writing the permitted secondary data identifier to the acquisition card, all the primary data identifiers in the storage space corresponding to the primary data identifier can be read back, effectively reducing the operation volume.

[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 resource amount 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 the 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 terminal 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 constitute 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 the flowchart of the transmission method in the present invention; Figure 2 is the structural schematic diagram of the computer terminal and the acquisition card terminal in the present invention; Figure 3 is the structural block diagram of the transmission system 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 several first-level data identifiers corresponding to the image data, the acquisition card directly accesses the image buffer on the computer side according to the first-level data identifiers to transfer the image data. Among them, the first-level data identifiers include the target storage address and the data transfer volume 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 transfer. When the cache space is full, the writing stops. This solution requires the CPU to be closely involved, has a high occupancy rate, and there is a risk that the bandwidth will decrease due to the data identifiers being used up but not written yet.

[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. The transmission method includes: Step 1: Construct a second-level data identifier queue on the computer side so that any second-level data identifier corresponds to several first-level data identifiers continuously stored on the computer side. Among them, the second-level data identifier is used to represent the starting storage address and the storage quantity of the corresponding several first-level data identifiers.

[0025] As Figure 2 shown, it is a schematic structural diagram of the computer side and the acquisition card side. Before starting the image transmission, determine the number N (N≥2) of computer-side image buffers to be opened; for each image buffer, first apply for the image buffer in the computer-side memory, and generate the first-level data identifier of the image buffer according to the actual memory space obtained. For example, the first image buffer requires K1 first-level data identifiers to describe, 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-side memory. Store the first-level data identifiers of the image buffer continuously in order in the corresponding storage space; according to the specific information of the first-level data identifier storage space (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, forming a second-level data identifier queue. At this time, through any second-level data identifier, several first-level data identifiers corresponding to the image buffer can be quickly read, without the need for a 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 reads the corresponding several first-level data identifiers according to different second-level data identifiers in turn.

[0027] As Figure 2 shown, the acquisition card stores the secondary data identifiers obtained from the secondary data identifier queue by setting a secondary data identifier FIFO. Since the secondary data identifiers correspond to the starting storage addresses and storage quantities of several primary data identifiers, for each secondary data identifier read from the secondary data identifier FIFO, multiple consecutive primary data identifiers can be read from the primary data identifier storage space according to the starting storage addresses and storage quantities.

[0028] Step 3: Store all the primary data identifiers corresponding to the current secondary data identifier in the same primary data identifier FIFO at the acquisition card end in sequence, and use two primary data identifier FIFOs to store alternately to complete the reading of all secondary data identifiers.

[0029] As Figure 2 shown, the acquisition card stores the primary data identifiers read from the primary data identifier storage space by setting two primary data identifier FIFOs (primary data identifier FIFO-A and primary data identifier FIFO-B). For the primary data identifier FIFO, it can be read while writing, and there is no need to store all the primary data identifiers corresponding to the secondary data identifier at one time.

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

[0031] Step 4: Read all the primary data identifiers in the current primary data identifier FIFO in sequence until the cumulative number of times the acquisition card writes the corresponding image data to the computer end reaches the storage quantity of the primary data identifiers represented by the corresponding secondary data identifier, so as to complete the transmission of the current frame of image data, and thus alternately complete the reading of the corresponding primary data identifiers in the two primary data identifier FIFOs.

[0032] Before the start of image data transmission for each frame, the number N of computer - side image buffers to be allocated and the number of primary data identifiers required for each image buffer have been determined. Moreover, since one primary data identifier FIFO corresponds to multiple primary data identifiers of one secondary data identifier, as long as the number of corresponding transmission times of the primary data identifiers executed by the current primary data identifier FIFO is equal to the storage quantity of the primary data identifiers represented by the corresponding secondary data identifier, it can be regarded as completing all data transmissions of the current frame of image data. 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 data corresponding to one secondary data identifier is completed.

[0033] Among them, the completion of reading all secondary data identifiers and the alternate completion of reading the corresponding primary data identifiers in two primary data identifier FIFOs are carried out in parallel in terms of time.

[0034] Step 3 shows how to complete the reading of all secondary data identifiers. Its essence lies in reading primary data identifiers according to secondary data identifiers. 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 corresponding data transmissions according to primary data identifiers, that is, directly writing to the image buffer. Therefore, Step 3 and Step 4 can be carried out in parallel during the specific execution process to achieve synchronous writing and reading of primary data identifiers, effectively improving data transmission efficiency and bandwidth.

[0035] In summary, after the primary data identifiers are determined by the computer - side and stored in the computer - side memory, the CPU sends the memory addresses of the stored primary data identifiers and the quantity of stored primary data identifiers (i.e., the data volume of the stored primary data identifiers) to the acquisition card after representing them through secondary data identifiers. When the acquisition card needs primary data identifiers for corresponding image data transmission and writing, it reads these primary data identifiers from the computer - side memory by itself according to the secondary data identifiers. Still calculated based on an average of 4KB of transmission data volume described by each primary data identifier and a size of 16B for one primary data identifier, the transmission of a 12MB frame of image data requires 3072 primary data identifiers, and 48KB of storage space for primary data identifiers needs to be allocated 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.

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

[0037] At the start of 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 more secondary data identifiers are allowed to 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 the state that they cannot be written to the acquisition card secondary data identifier FIFO again.

[0038] After the CPU receives an interrupt signal indicating that the writing of an image buffer has been completed, it 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 secondary data identifier corresponding to this buffer to the state that it can be written to the acquisition card secondary data identifier FIFO again. Every time the CPU receives an interrupt signal indicating that the writing of an image buffer has been completed, it can also 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 more secondary data identifiers are allowed to be written to it at most, and obtains the secondary data identifiers that do not exceed this number and are in the state of being allowed to be written to the acquisition card from the secondary data identifier queue and writes them to the secondary data identifier FIFO in sequence.

[0039] In order to store all the primary data identifiers corresponding to the current secondary data identifier in the same primary data identifier FIFO at the acquisition card end in sequence, the specific method includes: monitoring the number of primary data identifiers in the current primary data identifier FIFO in real time: If this number is greater than the first threshold, stop writing the primary data identifiers; If this number is less than the second threshold, continue to write the primary data identifiers 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.

[0040] For each secondary data identifier read from the secondary data identifier FIFO, it is necessary to read back the corresponding storage quantity of primary data identifiers from the primary data identifier storage space on the computer side 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, writing needs to be stopped. 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.

[0041] Through the reasonable setting of the first threshold, that is, the almost full threshold, a certain buffer space is reserved, which can effectively avoid data overflow caused by response lag. Through the reasonable setting of the second threshold, that is, the almost empty threshold, the minimum data volume reserved 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 primary data identifier FIFO can achieve a balance between reliability (preventing overflow / underflow) and efficiency (high bandwidth utilization).

[0042] In order to avoid the primary data identifiers of multiple image buffers being aliased and written into the same primary data identifier FIFO at the same time, the writing state of the current primary 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 primary data identifiers corresponding to different secondary data identifiers from being written into the current primary data identifier FIFO at the same time; After the transmission of the current frame of image data is completed, it is adjusted to the non-Busy state to allow the primary data identifiers corresponding to new secondary data identifiers to be written into the current primary data identifier FIFO.

[0043] The following combines specific embodiments to jointly illustrate the real-time control of the writing state of the current primary data identifier FIFO and the real-time monitoring of the number of primary data identifiers in the current primary data identifier FIFO: Before starting the transmission, the acquisition card clears the secondary data identifier FIFO, the primary data identifier FIFO-A, and the primary data identifier FIFO-B, and sets the primary data identifier FIFO-A and the primary data identifier FIFO-B to the non-Busy state. After starting the transmission, when the acquisition card detects that there are secondary data identifiers in the secondary data identifier FIFO, it starts to perform the primary data identifier read-back.

[0044] The read-back and write process corresponding to the first secondary 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 a state close to full (greater than the threshold for being close to full), 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 read-back operations have been completed, continuously monitor the state of the primary data identifier FIFO-A. If the primary data identifier FIFO-A returns to a state close to empty (less than the threshold for being close to empty), 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.

[0045] The read-back and write process corresponding to the second secondary data identifier is as follows: After completing the read-back and write process corresponding to 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 operations with the same logic on the primary data identifier FIFO-B with reference to the read-back and write process corresponding to 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.

[0046] The read-back and write process corresponding to the third secondary data identifier is as follows: After completing the read-back and write process corresponding to the second secondary data identifier, determine 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 in the non-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; loop in this way, 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 into the same FIFO at the same time.

[0047] 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, that is, 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, and for each execution of the image data transmission corresponding to one primary data identifier, increment FIFO-A-CNT one by one until FIFO-A-CNT reaches FIFO-A-NUM, that is, 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.

[0048] 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, and is accumulated through FIFO-B-CNT. After all the first-level data identifiers corresponding to the image buffer of 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.

[0049] By repeatedly executing the above steps, the acquisition card can continuously transfer image data directly to the computer's memory until the transfer stops.

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

[0051] 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 failed application when 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 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 completely transmitted.

[0052] 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 each time the image data transmission 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, one second-level data identifier corresponds to several image buffers, specifically as follows: The first-level data identifiers of multiple image buffers can be stored in a continuous storage space and correspond to one second-level data identifier. When the image data transmission of all the first-level data identifiers corresponding to this second-level data identifier is completed and the CPU receives an interrupt signal, it is considered that the image data transmission of this batch of image buffers corresponding to this 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.

[0053] 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 transmission 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, specifically 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 transmission corresponding to this first-level data identifier is completed, the acquisition card can send an interrupt signal to inform the CPU that the transmission of an image buffer has been completed; at the same time, when starting to execute the image data transmission of the next first-level data identifier, if there is a concept of frames in the stream data or cache data, the image transmission of a new buffer should start from the beginning 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.

[0054] As described above, whenever 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 the current image buffer has completed half or other proportions of the transmission. The application layer can then 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.

[0055] As Figure 3 shown, the second aspect of the present invention further provides a data transmission system, including: A queue construction module for constructing a second-level data identifier queue on the computer side, so that any second-level data identifier corresponds to a plurality of consecutive first-level data identifiers stored in the computer side, where the second-level data identifier is used to represent the starting storage address and storage quantity of the corresponding plurality of first-level data identifiers.

[0056] A queue acquisition module for acquiring the second-level data identifiers in the second-level data identifier queue and writing them into the acquisition card side in sequence, so that the acquisition card side sequentially reads the corresponding plurality of first-level data identifiers according to different second-level data identifiers.

[0057] An identifier writing module for sequentially storing 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, and alternately storing them using two first-level data identifier FIFOs to complete the reading of all second-level data identifiers.

[0058] An identifier reading module for sequentially reading all the first-level data identifiers in the current first-level data identifier FIFO until the cumulative number of times the acquisition card side writes the corresponding image data to the computer side reaches the storage quantity of the first-level data identifiers represented by the corresponding second-level data identifier, to complete the transmission of the current frame of image data, and thus alternately complete the reading of the corresponding first-level data identifiers in the two first-level data identifier FIFOs.

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

[0060] 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 conjunction with an instruction execution system, apparatus, or device.

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

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

[0063] The computer program code for performing the operations of this application can be written in one or more programming languages or a combination 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 can be executed entirely on the user's computer, partially on the user's computer, executed as an independent 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 can 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 can be connected to an external computer (for example, by using an Internet service provider to connect through the Internet).

[0064] In the description of this specification, the descriptions referring to the terms "one embodiment", "example", "specific example", etc. mean 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.

[0065] The foregoing has shown and described the basic principles, main features and advantages of the present invention. Those skilled in the art should understand that the present invention is not limited by the above embodiments, and the above embodiments and the descriptions in the specification are only used to 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, wherein, 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 at the computer side, so that any secondary data identifier corresponds to a number of consecutive primary data identifiers stored in the computer side, where 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; Read all the primary data identifiers in the current primary data identifier FIFO in sequence until the cumulative number of times the acquisition card side writes the corresponding image data to the computer side reaches the storage quantity of the primary data identifiers represented by the corresponding secondary data identifier, so as to complete the transmission of the current frame of image data, and thus 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 terms of time.

2. The image data transmission method according to claim 1, wherein Whenever the transmission of the current frame of image data is completed, judge the number of secondary data identifiers allowed to be written by the acquisition card side, obtain the secondary data identifiers that do not exceed this quantity and are allowed to be written into the acquisition card side from the secondary data identifier queue, and 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 into the acquisition card side again.

3. The image data transmission method according to claim 1, wherein Storing 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 includes: real-time monitoring of the number of primary data identifiers in the current primary data identifier FIFO: If the quantity is greater than the first threshold, stop writing the primary data identifier; If the quantity is less than the second threshold, continue to write the primary data identifier until the quantity is greater than the first threshold or all the primary data identifiers corresponding to the current secondary data identifier have been completely read.

4. A method for transmitting image data according to claim 3, characterized in that, Real-time control the writing state of the current primary data identifier FIFO: Adjust to the Busy state during the writing process to limit the simultaneous writing of the primary data identifiers corresponding to different secondary data identifiers into the current primary data identifier FIFO; Adjust to the non-Busy state after the transmission of the current frame of image data to allow the primary data identifiers corresponding to the new secondary data identifier to be written into the current primary data identifier FIFO.

5. A method for transmitting image data 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.

6. The 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.

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

8. A method for transmitting image data according to any one of claims 1-6, characterized in that, Monitor the number of first-level data identifiers read in the first-level data identifier FIFO in real time, and when the number reaches a preset value, feedback it to the CPU to process the transmitted part of the current frame image data in advance.

9. A data transmission system, characterized in that, Including: A queue construction module for constructing a second-level data identifier queue on the computer side, so that any second-level data identifier corresponds to a number of consecutive first-level data identifiers stored in the computer side, where the second-level data identifier is used to represent the starting storage address and storage quantity of the corresponding number of first-level data identifiers; A queue acquisition module for acquiring the second-level data identifiers in the second-level data identifier queue and writing them into the acquisition card side in sequence, so that the acquisition card side reads the corresponding number of first-level data identifiers according to different second-level data identifiers in sequence; An identifier writing module for sequentially storing 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, and alternately storing them using two first-level data identifier FIFOs to complete the reading of all second-level data identifiers; An identifier reading module for sequentially reading all the first-level data identifiers in the current first-level data identifier FIFO until the cumulative number of times the acquisition card side writes the corresponding image data to the computer side reaches the storage quantity of the first-level data identifiers represented by the corresponding second-level data identifier, so as to complete the transmission of the current frame image data, and thus alternately complete the reading of the corresponding first-level data identifiers in the two first-level data identifier FIFOs.

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 described in any one of claims 1-8.