A method, apparatus and storage medium for low-rate adaptive image frame transmission
By employing a multi-level caching architecture and a credit flow control mechanism, the problems of buffer overflow and data loss in high-speed input and low-speed output scenarios are solved, enabling adaptive transmission of image frames, improving transmission efficiency and stability, and making it suitable for aerospace embedded systems.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- TECH & ENG CENT FOR SPACE UTILIZATION CHINESE ACAD OF SCI
- Filing Date
- 2026-05-20
- Publication Date
- 2026-07-17
AI Technical Summary
In asymmetric transmission scenarios with high-speed input and low-speed output, existing buffer management methods are prone to buffer overflow, data loss, abnormal control command recognition, transmission interruption, inability to maintain link activity, and insufficient transmission reliability and stability.
A multi-level caching architecture is adopted, including a first-level caching unit and a second-level caching unit. The transmission rate is dynamically adjusted through a credit flow control mechanism, combined with frame boundary state management, to achieve adaptive transmission of image frames and ensure data integrity and continuity.
It achieves adaptive image frame transmission in asymmetric scenarios with high and low data rates, avoiding buffer overflow and data loss, improving transmission efficiency and system stability, and is suitable for high-reliability application scenarios such as aerospace and embedded systems.
Smart Images

Figure CN122420533A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of embedded data transmission technology, specifically to a low-rate adaptive image frame transmission method, apparatus, and storage medium. Background Technology
[0002] In engineering applications of data acquisition and remote transmission, there is often a significant difference in transmission rate between the data sending end and the receiving end. Continuous data transmission is usually achieved by combining buffering and flow control.
[0003] A common approach is to set up a buffer storage area at the receiving end to temporarily store the data input from the sending end. When the buffer reaches a certain occupancy threshold, a pause command is sent back to the sending end. Upon receiving the command, the sending end stops transmitting data and resumes transmission only after the buffer space is released. This stop-and-wait control logic is simple to implement, has low hardware dependency, and is widely used in general data transmission scenarios.
[0004] However, in asymmetric transmission scenarios with high-speed input and low-speed output, existing methods have significant limitations: There is a delay in the feedback and execution of pause commands, which can easily lead to buffer overflow and packet loss; when control commands and business data are transmitted through the same channel, issues such as command recognition anomalies or poor data transparency can easily occur; when feedback commands are lost or transmission anomalies occur, the sending end is prone to entering a continuous waiting state, causing transmission interruption. Furthermore, existing solutions typically only focus on buffer occupancy status and lack fine-grained management of data frame structure. When maintaining a connection on a low-speed link for an extended period, they cannot effectively maintain the link's active state, and the overall transmission reliability and stability are insufficient to meet the requirements of high-reliability application scenarios. Summary of the Invention
[0005] The technical problem to be solved by the present invention is to provide a low-rate adaptive image frame transmission method, apparatus and storage medium to address the shortcomings of the prior art.
[0006] The technical solution of the present invention to solve the above-mentioned technical problems is as follows: A low-rate adaptive image frame transmission method, comprising the following steps: S1. Receive image data stream packets sent by the data sending end through the high-speed interface, extract the valid data and packet status information from the image data stream packets, and store the valid data in the first-level cache unit. The valid data is a component of a single frame image data, and the packet status information is used to identify the position status of the valid data in the single frame image data. S2. Based on the effective data length stored in the first-level cache unit this time, update the remaining space credit value of the first-level cache unit, generate flow control feedback information containing the remaining space credit value and send it to the data sending end. The flow control feedback information is used to enable the data sending end to control the sending of subsequent image data stream packets based on the remaining space credit value. S3. Repeat steps S1 and S2 to continuously receive image data stream packets and extract valid data until the packet status information of the current image data stream packet is identified as the frame end state in the frame boundary state, and complete the reception of all valid data corresponding to the single frame image data. S4. Transfer the single-frame image data in the first-level cache unit to the second-level cache unit. When the amount of single-frame image data in the second-level cache unit reaches the preset effective packet length, or when the single-frame image data has contained the effective data corresponding to the frame end state in the frame boundary state, reassemble the single-frame image data into an application data packet. S5. The application data packet is sent to the data receiving end through a low-speed transmission link to complete the image frame transmission.
[0007] Based on the above technical solution, the present invention can be further improved as follows.
[0008] Further, S1, receiving image data stream packets sent by the data sending end through the high-speed interface, extracting valid data and packet status information from the image data stream packets, and storing the valid data into the first-level cache unit, including: S11. The main control device receives image data stream packets sent by the data sending end through a high-speed interface, performs verification processing on the received image data stream packets, and discards the image data stream packets if the verification fails. S12. Extract the valid data field and packet status information field from the verified image data stream packet, respectively; S13. Store the valid data corresponding to the extracted valid data fields into the first-level cache unit according to the receiving order, and record the packet status information corresponding to the extracted packet status information fields.
[0009] Further, S2, based on the effective data length stored in the first-level cache unit this time, the remaining space credit value of the first-level cache unit is updated, flow control feedback information containing the remaining space credit value is generated and sent to the data sending end. The flow control feedback information is used to enable the data sending end to control the sending of subsequent image data stream packets based on the remaining space credit value, including: S21. Obtain the total storage capacity of the first-level cache unit and the length of the effective data stored in the first-level cache unit this time. Based on the length of the effective data stored in the first-level cache unit this time, obtain the total length of the currently stored effective data. S22. Calculate and update the remaining space credit value of the first-level cache unit by subtracting the total length of currently stored valid data from the total storage capacity of the first-level cache unit; S23. The updated remaining space credit value is encapsulated into flow control feedback information according to the preset flow control frame format. The flow control feedback information also includes frame identification information, which is used to distinguish the flow control instructions corresponding to different frames. S24. The encapsulated flow control feedback information is sent to the data sending end through the same high-speed interface as the received image data stream packet, so that the data sending end can dynamically adjust the sending rate and timing of subsequent image data stream packets according to the received remaining space credit value.
[0010] Further, S4, the single-frame image data in the first-level cache unit is transferred to the second-level cache unit. When the amount of single-frame image data in the second-level cache unit reaches the preset effective packet length, or when the single-frame image data already contains the effective data corresponding to the end state in the frame boundary state, the single-frame image data is reassembled into an application data packet, including: S41. Transfer the valid data corresponding to the single frame image stored in the first-level buffer unit to the second-level buffer unit in sequence according to the receiving time order, and synchronously record the packet status information corresponding to each valid data. S42. During the data transfer process, the total length of the currently stored valid data in the secondary cache unit is counted in real time, and it is simultaneously determined whether the single frame image data has contained the valid data corresponding to the end state in the frame boundary state. S43. When the total length of valid data in the secondary cache unit reaches the preset valid packet length, or when the single frame image data has contained valid data corresponding to the frame end state in the frame boundary state, the valid data in the secondary cache unit is framed according to the preset format and reassembled into an application data packet. S44. After each application data packet reassembly is completed, clear the reassembled valid data and corresponding packet status information in the secondary buffer unit, and continue to receive subsequent transferred valid data until the reassembly of all valid data of a single frame image is completed.
[0011] Furthermore, it also includes the step of: when it is detected that there is no single frame image data to be sent in the secondary cache unit, sending a pre-formatted padding data packet to the data receiving end through a low-speed transmission link in order to maintain the link active state.
[0012] Furthermore, it also includes the following steps: After receiving all valid data corresponding to a single frame of image data, or when the interval between two adjacent flow control feedback information transmissions reaches a preset period, a heartbeat flow control packet is actively sent to the data sending end according to the preset period. The heartbeat flow control packet carries the remaining space credit value of the current first-level cache unit.
[0013] Furthermore, the packet state information includes at least one of frame start state, frame middle state, and frame end state.
[0014] Another technical solution of the present invention to solve the above-mentioned technical problems is as follows: A low-rate adaptive image frame transmission device, comprising: The data receiving and caching module is used to receive image data stream packets sent by the data sending end through a high-speed interface, extract the valid data and packet status information from the image data stream packets, and store the valid data into a first-level cache unit. The valid data is a component of a single frame image data, and the packet status information is used to identify the position and status of the valid data in the single frame image data. The credit flow control feedback module is used to update the remaining space credit value of the first-level cache unit based on the effective data length stored in the first-level cache unit this time, generate flow control feedback information containing the remaining space credit value and send it to the data sending end. The flow control feedback information is used to enable the data sending end to control the sending of subsequent image data stream packets based on the remaining space credit value. The cyclic reception control module is used to continuously receive image data stream packets and extract valid data until the packet status information of the current image data stream packet is identified as the frame end state in the frame boundary state, thus completing the reception of all valid data corresponding to the single frame image data. The data reassembly module is used to transfer single-frame image data in the first-level cache unit to the second-level cache unit. When the amount of single-frame image data in the second-level cache unit reaches the preset effective packet length, or when the single-frame image data has contained the effective data corresponding to the end state in the frame boundary state, the single-frame image data is reassembled into an application data packet. The data transmission module is used to send the application data packets to the data receiving end via a low-speed transmission link to complete the image frame transmission.
[0015] Another technical solution of the present invention to solve the above-mentioned technical problems is as follows: a low-rate adaptive image frame transmission device, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein when the processor executes the computer program, it implements the low-rate adaptive image frame transmission method as described above.
[0016] Another technical solution of the present invention to solve the above-mentioned technical problems is as follows: a computer-readable storage medium storing a computer program, which, when executed by a processor, implements the low-rate adaptive image frame transmission method as described above.
[0017] The beneficial effects of this invention are as follows: By constructing a complete process of high-speed reception, credit flow control, whole-frame reception, secondary buffer reassembly, and low-speed transmission, adaptive transmission of image frames in asymmetric high- and low-rate scenarios is achieved. The remaining space credit value is used as the core control basis to constrain the behavior of the transmitting end from the source, avoiding buffer overflow and data loss. Based on the frame boundary state, complete reception and accurate framing of a single image frame are achieved, ensuring data structure integrity and continuous transmission. Overall, high-speed acquisition and low-speed output are decoupled, eliminating the need for additional hardware control lines, effectively improving transmission efficiency and system stability. It is adaptable to high-reliability application scenarios such as aerospace and embedded systems, providing a universal solution for reliable low-rate transmission of high-speed image data. Attached Figure Description
[0018] Figure 1 A flowchart of a low-rate adaptive image frame transmission method provided in an embodiment of the present invention; Figure 2 A flowchart of an image download and transmission method for a data sending end provided in an embodiment of the present invention; Figure 3 A flowchart of the data transmission SPI transmission and credit flow control collaborative control method provided in an embodiment of the present invention; Figure 4 This is a block diagram of a low-rate adaptive image frame transmission device provided in an embodiment of the present invention. Detailed Implementation
[0019] The principles and features of the present invention are described below with reference to the accompanying drawings. The examples given are only for explaining the present invention and are not intended to limit the scope of the present invention.
[0020] Example 1: As Figure 1 As shown, this embodiment of the invention provides a low-rate adaptive image frame transmission method, including the following steps: S1. Receive image data stream packets sent by the data sending end through the high-speed interface, extract the valid data and packet status information from the image data stream packets, and store the valid data in the first-level cache unit. The valid data is a component of a single frame image data, and the packet status information is used to identify the position status of the valid data in the single frame image data. S2. Based on the effective data length stored in the first-level cache unit this time, update the remaining space credit value of the first-level cache unit, generate flow control feedback information containing the remaining space credit value and send it to the data sending end. The flow control feedback information is used to enable the data sending end to control the sending of subsequent image data stream packets based on the remaining space credit value. S3. Repeat steps S1 and S2 to continuously receive image data stream packets and extract valid data until the packet status information of the current image data stream packet is identified as the frame end state in the frame boundary state, and complete the reception of all valid data corresponding to the single frame image data. S4. Transfer the single-frame image data in the first-level cache unit to the second-level cache unit. When the amount of single-frame image data in the second-level cache unit reaches the preset effective packet length, or when the single-frame image data has contained the effective data corresponding to the frame end state in the frame boundary state, reassemble the single-frame image data into an application data packet. S5. The application data packet is sent to the data receiving end through a low-speed transmission link to complete the image frame transmission.
[0021] Specifically, Table 1 shows the data stream packet format, including information such as valid data, sequence marker, verification result, email port number, and data length in the image data stream packet.
[0022] Table 1 Specifically, Table 2 shows the data stream packet format. As shown in Table 2, to prevent overflow of the first-level buffer FIFO, this embodiment adopts a credit flow control mechanism based on remaining space query. The capacity of the first-level buffer FIFO is set to be no less than twice the length of a single data stream packet to match the SPI burst write rate and subsequent data processing rate. In this embodiment, the first-level buffer FIFO specifically uses a storage capacity of 4096 bytes. The system counts the read and write pointers of the first-level buffer FIFO in real time to obtain the current remaining storage space. Whenever a fixed-length data block is successfully read from the first-level buffer FIFO, a flow control packet is immediately sent to the imaging system to announce the current remaining space information, where the imaging system is the data sender. After receiving the flow control packet, the data sender directly refreshes the local credit value according to the remaining space value carried in the flow control packet, completing the synchronous update of credit information. This mechanism is a sender-driven adaptive rate control method. The sender can determine whether to start data transmission based on the remaining space credit value fed back by the receiver, avoiding buffer overflow from the source.
[0023] Table 2 Specifically, the packet state information includes at least one of frame start state, frame middle state, and frame end state.
[0024] This embodiment uses an SPI communication interface control module as the data interaction portal between the experimental control master and the imaging system. The image data stream packets sequentially go through data reception, verification, buffering, and flow control management processes. The image data stream packets include control codes, sequence flags, mailbox ports, valid data lengths, valid data areas, and checksum fields. Sequence flags include four types: start packets, intermediate packets, end packets, and independent data packets. SPI communication adopts a bidirectional transmission mode. The data stream packet transmission rate from the imaging system to the master is 33 MHz, and the flow control packet transmission rate from the master to the imaging system is 5 MHz. The first-level buffer uses a FIFO memory with a capacity of not less than twice the length of a single transmitted data stream packet. In this embodiment, a 4096-byte FIFO memory is specifically selected. The remaining space information is obtained by real-time statistical reading and writing pointers to achieve rate isolation between high-speed data reception and low-speed data processing.
[0025] In the above embodiments, by constructing a complete transmission process encompassing high-speed reception, credit flow control, full-frame reception, secondary buffer reassembly, and low-speed transmission, adaptive transmission of image frames in asymmetric high- and low-rate scenarios is achieved. This scheme uses the remaining space credit value as the core control basis, constraining the sending behavior of the transmitter from the source, effectively avoiding buffer overflow and data loss. Simultaneously, it relies on frame boundary states to achieve complete reception and accurate framing of single-frame image data, ensuring the structural integrity and transmission continuity of the image data. The overall process decouples high-speed acquisition from low-speed output, improving transmission efficiency and system stability without adding extra hardware control lines. It is adaptable to application scenarios with stringent reliability requirements, such as aerospace and embedded systems, providing a generalized solution for reliable low-rate transmission of high-speed image data.
[0026] Preferably, S1, receiving image data stream packets sent by the data sending end through a high-speed interface, extracting valid data and packet status information from the image data stream packets, and storing the valid data into a first-level cache unit, includes: S11. The main control device receives image data stream packets sent by the data sending end through a high-speed interface, performs verification processing on the received image data stream packets, and discards the image data stream packets if the verification fails. S12. Extract the valid data field and packet status information field from the verified image data stream packet, respectively; S13. Store the valid data corresponding to the extracted valid data fields into the first-level cache unit according to the receiving order, and record the packet status information corresponding to the extracted packet status information fields.
[0027] Specifically, the SPI communication interface control module in this embodiment supports multiple verification methods such as summation, XOR, and CRC8. Image data stream packets that fail verification are directly discarded to prevent erroneous data from entering subsequent transmission processes. The module extracts valid data, sequence flags, verification results, mailbox port numbers, and data length information from the image data stream packets and temporarily stores them in a first-level buffer FIFO. The valid data length of the image data stream packets can be flexibly configured by the imaging system, with a configuration range of 4 bytes to 1024 bytes. The temporal consistency and location traceability of single-frame image data are ensured through ordered caching and status recording.
[0028] In the above embodiments, by performing reception verification, field splitting, and ordered caching on image data stream packets, rapid filtering of abnormal data and accurate extraction of valid information are achieved. Abnormal data packets are directly discarded when verification fails, preventing erroneous data from entering the cache unit and affecting subsequent transmission processes, thus improving the accuracy and reliability of data transmission. Storing valid data in the order of reception and synchronously recording packet status information ensures the temporal consistency and location traceability of single-frame image data, providing an accurate data foundation for subsequent whole-frame reconstruction and frame status judgment. This enables the system to maintain stable processing capabilities even in continuous burst transmission scenarios, reducing the risk of frame corruption and data aliasing.
[0029] Preferably, S2, based on the effective data length stored in the first-level cache unit this time, the remaining space credit value of the first-level cache unit is updated, flow control feedback information containing the remaining space credit value is generated and sent to the data sending end, the flow control feedback information is used to enable the data sending end to control the sending of subsequent image data stream packets based on the remaining space credit value, including: S21. Obtain the total storage capacity of the first-level cache unit and the length of the effective data stored in the first-level cache unit this time. Based on the length of the effective data stored in the first-level cache unit this time, obtain the total length of the currently stored effective data. S22. Calculate and update the remaining space credit value of the first-level cache unit by subtracting the total length of currently stored valid data from the total storage capacity of the first-level cache unit; S23. The updated remaining space credit value is encapsulated into flow control feedback information according to the preset flow control frame format. The flow control feedback information also includes frame identification information, which is used to distinguish the flow control instructions corresponding to different frames. S24. The encapsulated flow control feedback information is sent to the data sending end through the same high-speed interface as the received image data stream packet, so that the data sending end can dynamically adjust the sending rate and timing of subsequent image data stream packets according to the received remaining space credit value.
[0030] Specifically, this embodiment adopts a credit flow control mechanism based on remaining space query. The capacity of the first-level buffer FIFO is set to 4096 bytes. Whenever a fixed-length data block is successfully read from the FIFO, a flow control packet is immediately sent to the imaging system. The flow control packet includes a control code, mailbox port, remaining byte space, flow control frame count, data padding, and checksum field. The control code is fixed at 0x55, and the data padding field is fixed at 0x5A. After receiving the flow control packet, the imaging system directly refreshes the local credit value according to the remaining space value to complete the credit synchronization update. Based on the credit value, it determines whether to start sending subsequent image data stream packets, thus avoiding buffer overflow from the source.
[0031] In the above embodiments, by accurately calculating the total cache capacity and the length of stored data, the remaining space credit value is updated in real time, enabling refined and quantitative control of the flow control strategy. Credit values and frame identification information are encapsulated according to a preset frame format, improving the identification accuracy and anti-interference capability of the flow control feedback packet and avoiding confusion of flow control commands. Flow control information is synchronously transmitted back via a high-speed interface, allowing the sending end to dynamically adjust the sending rate and timing based on the real-time remaining credit value, forming a closed-loop flow control. This significantly reduces the probability of cache overflow, solves the problems of delayed response and low control efficiency in traditional stop-and-wait flow control, and improves transmission throughput in high- and low-speed rate mismatch scenarios.
[0032] Preferably, S4, the single-frame image data in the first-level cache unit is transferred to the second-level cache unit. When the amount of single-frame image data in the second-level cache unit reaches the preset effective packet length, or when the single-frame image data already contains the effective data corresponding to the end state in the frame boundary state, the single-frame image data is reassembled into an application data packet, including: S41. Transfer the valid data corresponding to the single frame image stored in the first-level buffer unit to the second-level buffer unit in sequence according to the receiving time order, and synchronously record the packet status information corresponding to each valid data. S42. During the data transfer process, the total length of the currently stored valid data in the secondary cache unit is counted in real time, and it is simultaneously determined whether the single frame image data has contained the valid data corresponding to the end state in the frame boundary state. S43. When the total length of valid data in the secondary cache unit reaches the preset valid packet length, or when the single frame image data has contained valid data corresponding to the frame end state in the frame boundary state, the valid data in the secondary cache unit is framed according to the preset format and reassembled into an application data packet. S44. After each application data packet reassembly is completed, clear the reassembled valid data and corresponding packet status information in the secondary buffer unit, and continue to receive subsequent transferred valid data until the reassembly of all valid data of a single frame image is completed.
[0033] Preferably, the first-level cache unit is a FIFO memory, and the second-level cache unit is a dual-port RAM memory.
[0034] Specifically, in this embodiment, the first-level cache is a FIFO memory, and the second-level cache is a dual-port RAM memory. The dual-port RAM supports parallel read and write operations, and can simultaneously perform data writing and low-speed transmission processing. When data is transferred from the first-level cache to the second-level cache, packet status information is recorded synchronously. The frame assembly operation is triggered based on two conditions: the data length of the second-level cache reaches the preset effective packet length or the frame end state is detected. After the frame assembly is completed, the processed data area is cleared, realizing the recycling of the cache and the continuous reassembly of image data.
[0035] A FIFO memory is used as the first-level cache to achieve serial caching and ordered read / write of high-speed data, adapting to the characteristics of high-speed burst reception. A dual-port RAM is used as the second-level cache to achieve parallel read / write operations, allowing data writing and low-speed transmission to occur simultaneously, completely isolating rate conflicts between high-speed reception and low-speed transmission. This two-level storage architecture has a clear division of labor and high efficiency, improving data throughput and cache utilization, reducing timing convergence difficulty and logic resource consumption, and is compatible with embedded hardware platforms such as FPGAs. This hardware architecture optimizes system processing speed and operational stability, making it more suitable for the engineering implementation of space-based embedded systems.
[0036] Specifically, this embodiment uses an application data mailbox multiplexing module to complete the data transfer and organization from the first-level cache to the second-level cache. Image data is read from the first-level cache FIFO and written to a 4096×4-byte second-level cache dual-port RAM. The dual-port RAM supports parallel data writing and reading operations, effectively improving system throughput. During data processing, when the second-level cache data length reaches the configured 796-byte application data effective packet length, or when the sequence marker of the current image data stream packet is the end packet, the module concatenates the sequence marker, packet number, and packet length information into a status record and writes it to the application data status FIFO. Simultaneously, the application data downlink organization module interacts with the upstream device via an RS422 interface. Upon receiving an application data request command, it checks the application data status FIFO. If the status FIFO is not empty, it retrieves the corresponding length of data from the second-level cache and sends it through the RS422 interface. If the status FIFO is empty, it sends a fixed-padded packet consisting of 0x48 bytes to maintain link activity.
[0037] In the above embodiments, efficient utilization of the secondary buffer and accurate reassembly of image frames are achieved through ordered data transfer, real-time length statistics, frame state synchronization judgment, and segmented frame clearing. Data is moved according to the receiving sequence and the state is recorded synchronously to ensure the integrity of the frame structure; the dual-condition triggered frame assembly mechanism takes into account both fixed-length packing and automatic packing at the end of the frame, adapting to the flexible frame assembly needs of image data of different lengths; after each packing, the area of sent data is cleared, and subsequent data is continuously received, realizing the pipelined utilization of the buffer. This scheme improves data organization efficiency and packet regularity of low-speed links, reduces frame assembly overhead, and ensures the stability and orderliness of long-term continuous transmission.
[0038] Preferably, the method further includes the step of: When it is detected that there is no single-frame image data to be sent in the secondary buffer unit, a pre-formatted padding data packet is sent to the data receiving end through a low-speed transmission link to maintain the link's active state.
[0039] In the above embodiments, when there is no data to be sent in the secondary buffer, a pre-formatted padding data packet is actively sent to maintain the continuous activity of the low-speed transmission link and prevent the link from disconnecting, losing synchronization, or abnormally resetting due to prolonged idle time. The padding packet mechanism does not occupy effective data bandwidth, does not affect normal image frame transmission, and at the same time keeps the receiver in a stable clock synchronization and link detection state, improving the robustness of the system in low duty cycle transmission scenarios. This solution is simple, reliable, and easy to implement, and can effectively solve the problem of embedded low-speed links being prone to failure when idle, ensuring the stable operation of the entire transmission system for a long time.
[0040] like Figure 2 As shown, another embodiment of the present invention provides an image data download and transmission process on the data sending end side, specifically including the following steps: S11. The data sending end enters the image download processing flow and waits for the image data download command issued by the main control end. S12. After receiving the download command, first determine the camera ID specified in the command to identify the imaging device corresponding to the image data to be downloaded. S13. Determine if there is any application data that has not been completely sent. If so, proceed directly to the data sending process; otherwise, select the image data source according to the current working mode. S131. If it is a test shooting mode, retrieve and read the latest frame image data from DDR; S132. If it is not a test shooting mode, then retrieve and read the latest frame image data stored in the hard disk according to the time node; S14. Call the single-frame image sending interface to send single-frame image data to the master control terminal through the SPI communication link; S15. Determine whether the single-frame image data was sent successfully. If the sending fails, return to the step of waiting for download commands, wait again and process subsequent download commands; if the sending is successful, update the current working parameters and complete the image download and sending process.
[0041] In the above embodiments, a complete process of "command reception, camera ID determination, priority transmission of incomplete data, patterned image retrieval, SPI transmission, and status update" is implemented to achieve orderly downloading and reliable transmission of image data under different storage media and different working modes. The logic of prioritizing the transmission of incomplete data avoids transmission interruption and data loss. The dual-path image retrieval mechanism of DDR and hard disk adapts to both test shooting and regular working scenarios, ensuring the availability and continuity of image data under different states. This process, together with the credit flow control and secondary cache reorganization mechanism on the receiving end side, forms a complete closed loop, providing a standardized implementation path on the sending end side for image frame transmission in high- and low-rate asymmetric scenarios, and improving the robustness and adaptability of the overall transmission system.
[0042] Preferably, the method further includes the step of: After receiving all valid data corresponding to a single frame of image data, or when the interval between two adjacent flow control feedback information transmissions reaches a preset period, a heartbeat flow control packet is actively sent to the data sending end according to the preset period. The heartbeat flow control packet carries the remaining space credit value of the current first-level cache unit.
[0043] Specifically, this embodiment optimizes reliability to address the potential risk of interrupted flow control interaction. When the dual-port RAM of the main control's secondary cache is idle, the frequency of flow control interaction between the transmitter and the main control is high. The imaging system is prone to missing flow control packets or merging multiple flow control packets due to thread scheduling or interrupt handling, thereby disrupting the normal flow control interaction rhythm. Without a protection mechanism, the imaging system is highly likely to suspend the transmission process due to a long period without updating credit information. To address this, this embodiment adopts a dual protection mechanism of heartbeat continuation packets and proactive timeout transmission. On the main control side, a time-driven flow control strategy is added to the conventional event-driven flow control mechanism. The main control device proactively sends heartbeat flow control packets carrying information about the remaining space of the primary cache to the imaging system at a preset period of one second, maintaining periodic transmission even if the remaining space does not change. On the imaging system side, the single-frame image sending thread is optimized and a timeout wake-up proactive sending mechanism is added. When the sending thread is woken up by a timeout while waiting for the flow control packet, it compares the locally maintained remaining space credit value with the sending threshold. If the sending condition is met, it proactively initiates an image data stream packet transmission. Even if the flow control packet is not received multiple times consecutively, this proactive sending mechanism will not cause the main control side's first-level buffer to overflow. Through the dual insurance mechanism of the main control side's periodic keep-alive and the imaging system side's timeout retransmission, the unexpected interruption of the transmission process can be effectively avoided, allowing the system to adaptively enter a stable transmission flow control balance state, ensuring the complete and reliable transmission of large-volume image data in high- and low-rate asymmetric transmission scenarios.
[0044] The aforementioned dual protection mechanism effectively prevents the transmission process from being interrupted. Table 3 shows the available space credit recovery process. The system re-enters a steady state, and Table 3 illustrates the complete process from the first-level buffer having no available space (due to the upstream device suspending RS422 reception) to returning to normal. Ultimately, the system will adaptively enter a balanced state of approximately 25 "transmission flow control" cycles per second, completing the downlink transmission of a 3MB image frame in approximately 10 minutes.
[0045] Table 3 In the above embodiments, by actively sending heartbeat flow control packets after frame reception is completed or when the flow control interval times out, the remaining credit value in the first-level cache is continuously synchronized to the sending end, forming a dual guarantee mechanism of regular flow control and periodic heartbeats. This scheme can effectively address the credit asynchrony problem caused by the loss, merging, or delay of flow control feedback packets, preventing the sending end from entering a waiting deadlock state due to not receiving flow control instructions, and improving the system's anti-interference capability and anomaly self-healing capability. In aerospace applications with complex electromagnetic environments and high reliability requirements, it significantly improves the availability of transmission links and mission success rate.
[0046] like Figure 3As shown, another embodiment of the present invention provides a method for coordinated control of SPI transmission and credit flow control at a data transmission end, specifically including the following steps: S21. The data sending end starts sending single-frame image data, initializes the locally maintained remaining spatial credit value, and sets it to the preset sending threshold Tth. The sending threshold Tth is the minimum available spatial credit value for the data sending end to determine whether to start data sending. S22. The data sending end determines whether there is any data yet to be sent. If there is no data yet to be sent, the process ends; if there is still data yet to be sent, the subsequent steps are executed. S23. The data sending end determines whether it has received a command to stop sending application data. If it has received the command, the process ends; if it has not received the command, it executes the subsequent steps. S24. The data sending end waits for the master control device to return the available space information of the first-level cache. If the wait times out, the preset timeout active sending mechanism is triggered. If the timeout does not occur, the available FIFO space credit value maintained locally is updated according to the master control return value (i.e., the available FIFO space size is returned). S25. The data sender updates the available space credit value and the preset sending threshold. The comparison is performed only if the available space credit value is greater than or equal to the sending threshold. Only then will the image data stream packet sending process be initiated; S26. The data sending end determines the type of the data block to be sent, organizes and sends the corresponding image data stream packet according to the data block type, including the frame start packet (i.e., the first packet 01b), the frame middle packet (00b), or the frame end packet (i.e., the last packet 10b). S27. After each set of valid data is sent, the data sender updates the number of bytes sent L and synchronously updates the available space credit value maintained locally. S28. The data sending end continues to execute the above steps in a loop until the transmission of the entire frame of image data is completed.
[0047] In the above embodiments, credit value initialization, flow control information parsing, timeout waiting and active sending, and sending threshold-based methods are used. The collaborative process of transmission control, framed transmission, and real-time credit updates constructs a closed-loop credit flow control mechanism between the sender and receiver. Specifically, the preset transmission threshold Tth provides a clear transmission judgment criterion for the data sender; initially, the remaining space credit value is directly set to... This method ensures safe transmission based on threshold judgments from the start of the transmission process; the proactive timeout transmission mechanism effectively addresses scenarios where flow control feedback packets are lost or delayed, preventing transmission interruptions due to timeouts; and real-time synchronization of local credit values guarantees the accuracy of flow control logic. This approach, in conjunction with the receiver's credit calculation, heartbeat flow control, and data reassembly processes, further enhances the stability and reliability of high- and low-rate asymmetric transmission scenarios, enabling the system to maintain continuous and stable image frame transmission even in complex transmission environments.
[0048] Specifically, in this embodiment, the capacity of the first-level cache FIFO is... Given bytes, and assuming the current remaining space is F(t), the flow control mechanism's operation can be described as follows: 1) After the imaging system (i.e., the data transmitter) sends L bytes of data, the remaining space F(t) in the first-level buffer decreases by L bytes, i.e. ; 2) After the master controller reads D bytes of data from the L1 cache FIFO, the remaining space F(t) of the L1 cache increases by D bytes, i.e. This triggers the transmission of flow control packets, feeding back the current remaining space information to the imaging system (i.e., the data transmitter). 3) The transmission condition constraint of the imaging system is: only in the remaining space of the first-level buffer. Data transmission is only permitted when the specified threshold Tth is 2 × D bytes. 4) The capacity of the first-level buffer FIFO is not less than the transmission threshold Tth. In this embodiment, the length of data read in a single operation is D = 256 bytes.
[0049] The above strategy ensures This holds true consistently, and due to the sending threshold... With single transmission length Under normal flow control It is always no lower than D, thus reserving a sufficient safety margin for the controller's L1 cache.
[0050] Specifically, this embodiment also optimizes the sending granularity, adjusting the length of the data stream packet sent by the imaging system (i.e., the data sender) in a single transmission from 256 bytes to 512 bytes, while the main control device still triggers flow control packet transmission at a read granularity of 256 bytes. After the imaging system sends 512 bytes of data, it receives two flow control packets, each increasing the credit value by 256 bytes. Through the cumulative calculation of the local credit value, continuous control of the transmission behavior is achieved. This optimization reduces the number of times single-frame image data is sent, and also reduces the probability of process interruption due to abnormal single flow control packets. After the adjustment, the sending threshold remains twice the single read granularity, and the data stream packet transmission length remains twice the single read granularity, ensuring that the remaining space of the first-level cache is always not less than zero, preventing the main control first-level cache from overflowing, and guaranteeing the safe and reliable operation of the flow control mechanism.
[0051] Example 2: As Figure 4 As shown, an embodiment of the present invention provides a low-rate adaptive image frame transmission device, comprising: The data receiving and caching module is used to receive image data stream packets sent by the data sending end through a high-speed interface, extract the valid data and packet status information from the image data stream packets, and store the valid data into a first-level cache unit. The valid data is a component of a single frame image data, and the packet status information is used to identify the position and status of the valid data in the single frame image data. The credit flow control feedback module is used to update the remaining space credit value of the first-level cache unit based on the effective data length stored in the first-level cache unit this time, generate flow control feedback information containing the remaining space credit value and send it to the data sending end. The flow control feedback information is used to enable the data sending end to control the sending of subsequent image data stream packets based on the remaining space credit value. The cyclic reception control module is used to continuously receive image data stream packets and extract valid data until the packet status information of the current image data stream packet is identified as the frame end state in the frame boundary state, thus completing the reception of all valid data corresponding to the single frame image data. The data reassembly module is used to transfer single-frame image data in the first-level cache unit to the second-level cache unit. When the amount of single-frame image data in the second-level cache unit reaches the preset effective data packet length, or when the single-frame image data has contained the effective data corresponding to the end state in the frame boundary state, the single-frame image data is reassembled into an application data packet. The data transmission module is used to send the application data packets to the data receiving end via a low-speed transmission link to complete the image frame transmission.
[0052] Example 3: Another embodiment of the present invention provides a low-rate adaptive image frame transmission device, including a memory, a processor, and a computer program stored in the memory and executable on the processor. When the processor executes the computer program, it implements the low-rate adaptive image frame transmission method as described above.
[0053] Example 4: Another embodiment of the present invention provides a computer-readable storage medium storing a computer program that, when executed by a processor, implements the low-rate adaptive image frame transmission method as described above.
[0054] This invention has the following significant features: 1) A multi-level cache architecture is adopted to achieve rate decoupling. The first-level FIFO memory is used to buffer the burst write data of the SPI interface, and the second-level dual-port RAM memory is used to isolate the high-speed write and low-speed read processes, which can well adapt to the extreme rate difference between high-speed input and low-speed output scenarios.
[0055] 2) The credit-based flow control mechanism has higher transmission efficiency than the traditional stop-and-wait protocol. The sender can continuously send data after confirming that the receiver has sufficient buffer space, thereby improving the link utilization. At the same time, it can pause sending in time when the buffer space is insufficient to avoid data overflow and loss.
[0056] 3) It has strong scalability and can support multiple logical channels through email port configuration, which facilitates the subsequent expansion of multiple data sources.
[0057] 4) Key parameters such as data stream packet length and effective application data length can be flexibly configured to adapt to different application scenarios and transmission requirements.
[0058] 5) By using a heartbeat keep-alive mechanism and a timeout proactive transmission mechanism, dual reliability protection is formed, which improves the system's self-recovery capability and operational robustness in abnormal transmission scenarios.
[0059] It should be noted that, in this document, relational terms such as "first" and "second" are used only to distinguish one entity or operation from another, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Furthermore, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such process, method, article, or apparatus.
[0060] Those skilled in the art will clearly understand that, for the sake of convenience and brevity, the specific working process of the above-described apparatus and unit can be referred to the corresponding process in the foregoing method embodiments, and will not be repeated here.
[0061] In the several embodiments provided in this application, it should be understood that the disclosed apparatus and methods can be implemented in other ways. For example, the apparatus embodiments described above are merely illustrative. For instance, the division of units is only a logical functional division, and in actual implementation, there may be other division methods. For example, multiple units or components may be combined or integrated into another system, or some features may be ignored or not executed.
[0062] The units described as separate components may or may not be physically separate. The components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the units can be selected to achieve the purpose of the embodiments of the present invention, depending on actual needs.
[0063] Furthermore, the functional units in the various embodiments of the present invention can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit. The integrated unit can be implemented in hardware or as a software functional unit.
[0064] The above description is only a preferred embodiment of the present invention and is not intended to limit the present invention. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of the present invention should be included within the protection scope of the present invention.
Claims
1. A low-rate adaptive image frame transmission method, characterized in that, Includes the following steps: S1. Receive image data stream packets sent by the data sending end through the high-speed interface, extract the valid data and packet status information from the image data stream packets, and store the valid data in the first-level cache unit. The valid data is a component of a single frame image data, and the packet status information is used to identify the position status of the valid data in the single frame image data. S2. Based on the effective data length stored in the first-level cache unit this time, update the remaining space credit value of the first-level cache unit, generate flow control feedback information containing the remaining space credit value and send it to the data sending end. The flow control feedback information is used to enable the data sending end to control the sending of subsequent image data stream packets based on the remaining space credit value. S3. Repeat steps S1 and S2 to continuously receive image data stream packets and extract valid data until the packet status information of the current image data stream packet is identified as the frame end state in the frame boundary state, and complete the reception of all valid data corresponding to the single frame image data. S4. Transfer the single-frame image data in the first-level cache unit to the second-level cache unit. When the amount of single-frame image data in the second-level cache unit reaches the preset effective packet length, or when the single-frame image data has contained the effective data corresponding to the frame end state in the frame boundary state, reassemble the single-frame image data into an application data packet. S5. The application data packet is sent to the data receiving end through a low-speed transmission link to complete the image frame transmission.
2. The low-rate adaptive image frame transmission method according to claim 1, characterized in that, S1. Receive image data stream packets sent by the data sending end through a high-speed interface, extract valid data and packet status information from the image data stream packets, and store the valid data in a first-level cache unit, including: S11. The main control device receives image data stream packets sent by the data sending end through a high-speed interface, performs verification processing on the received image data stream packets, and discards the image data stream packets if the verification fails. S12. Extract the valid data field and packet status information field from the verified image data stream packet, respectively; S13. Store the valid data corresponding to the extracted valid data fields into the first-level cache unit according to the receiving order, and record the packet status information corresponding to the extracted packet status information fields.
3. The low-rate adaptive image frame transmission method according to claim 1, characterized in that, S2. Based on the effective data length stored in the first-level cache unit, update the remaining space credit value of the first-level cache unit, generate flow control feedback information containing the remaining space credit value, and send it to the data sending end. The flow control feedback information is used to enable the data sending end to control the sending of subsequent image data stream packets based on the remaining space credit value, including: S21. Obtain the total storage capacity of the first-level cache unit and the length of the effective data stored in the first-level cache unit this time. Based on the length of the effective data stored in the first-level cache unit this time, obtain the total length of the currently stored effective data. S22. Calculate and update the remaining space credit value of the first-level cache unit by subtracting the total length of currently stored valid data from the total storage capacity of the first-level cache unit; S23. The updated remaining space credit value is encapsulated into flow control feedback information according to the preset flow control frame format. The flow control feedback information also includes frame identification information, which is used to distinguish the flow control instructions corresponding to different frames. S24. The encapsulated flow control feedback information is sent to the data sending end through the same high-speed interface as the received image data stream packet, so that the data sending end can dynamically adjust the sending rate and timing of subsequent image data stream packets according to the received remaining space credit value.
4. The low-rate adaptive image frame transmission method according to claim 1, characterized in that, S4. Transfer the single-frame image data in the first-level cache unit to the second-level cache unit. When the amount of single-frame image data in the second-level cache unit reaches the preset effective packet length, or when the single-frame image data already contains the effective data corresponding to the end state in the frame boundary state, reassemble the single-frame image data into an application data packet, including: S41. Transfer the valid data corresponding to the single frame image stored in the first-level buffer unit to the second-level buffer unit in sequence according to the receiving time order, and synchronously record the packet status information corresponding to each valid data. S42. During the data transfer process, the total length of the currently stored valid data in the secondary cache unit is counted in real time, and it is simultaneously determined whether the single frame image data has contained the valid data corresponding to the end state in the frame boundary state. S43. When the total length of valid data in the secondary cache unit reaches the preset valid packet length, or when the single frame image data has contained valid data corresponding to the frame end state in the frame boundary state, the valid data in the secondary cache unit is framed according to the preset format and reassembled into an application data packet. S44. After each application data packet reassembly is completed, clear the reassembled valid data and corresponding packet status information in the secondary buffer unit, and continue to receive subsequent transferred valid data until the reassembly of all valid data of a single frame image is completed.
5. The low-rate adaptive image frame transmission method according to claim 1, characterized in that, It also includes the following steps: When it is detected that there is no single-frame image data to be sent in the secondary buffer unit, a pre-formatted padding data packet is sent to the data receiving end through a low-speed transmission link to maintain the link's active state.
6. The low-rate adaptive image frame transmission method according to claim 1, characterized in that, It also includes the following steps: After receiving all valid data corresponding to a single frame of image data, or when the interval between two adjacent flow control feedback information transmissions reaches a preset period, a heartbeat flow control packet is actively sent to the data sending end according to the preset period. The heartbeat flow control packet carries the remaining space credit value of the current first-level cache unit.
7. The low-rate adaptive image frame transmission method according to any one of claims 1 to 6, characterized in that, The packet status information includes at least one of frame start status, frame middle status, and frame end status.
8. A low-rate adaptive image frame transmission device, characterized in that, include: The data receiving and caching module is used to receive image data stream packets sent by the data sending end through a high-speed interface, extract the valid data and packet status information from the image data stream packets, and store the valid data into a first-level cache unit. The valid data is a component of a single frame image data, and the packet status information is used to identify the position and status of the valid data in the single frame image data. The credit flow control feedback module is used to update the remaining space credit value of the first-level cache unit based on the effective data length stored in the first-level cache unit this time, generate flow control feedback information containing the remaining space credit value and send it to the data sending end. The flow control feedback information is used to enable the data sending end to control the sending of subsequent image data stream packets based on the remaining space credit value. The cyclic reception control module is used to continuously receive image data stream packets and extract valid data until the packet status information of the current image data stream packet is identified as the frame end state in the frame boundary state, thus completing the reception of all valid data corresponding to the single frame image data. The data reassembly module is used to transfer single-frame image data in the first-level cache unit to the second-level cache unit. When the amount of single-frame image data in the second-level cache unit reaches the preset effective packet length, or when the single-frame image data has contained the effective data corresponding to the end state in the frame boundary state, the single-frame image data is reassembled into an application data packet. The data transmission module is used to send the application data packets to the data receiving end via a low-speed transmission link to complete the image frame transmission.
9. A low-rate adaptive image frame transmission device, characterized in that, The method includes a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein when the processor executes the computer program, it implements the low-rate adaptive image frame transmission method as described in any one of claims 1 to 7.
10. A computer-readable storage medium storing a computer program, characterized in that, When the computer program is executed by a processor, it implements the low-rate adaptive image frame transmission method as described in any one of claims 1 to 7.